# resolve links - $0 may be a softlink
PRG="$0"

while [ -h "$PRG" ] ; do
    ls=`ls -ld "$PRG"`
    link=`expr "$ls" : '.*-> \(.*\)$'`
    if expr "$link" : '/.*' > /dev/null; then
        PRG="$link"
    else
        PRG=`dirname "$PRG"`/"$link"
    fi
done

PRGDIR=`dirname "$PRG"`

CALSSPATH="$PRGDIR"/xmltool.jar

if [ ! -d "$1" ]; then
    echo "Usage: `basename $0` /path/to/books";
    exit 1;
fi

java -cp "$CALSSPATH" com.ltv.xiangqibook.GameGenerator "$1"
java -cp "$CALSSPATH" com.ltv.xiangqibook.TreeGenerator "$1"
